package com.csw.shuanfa.bitset;

import java.util.BitSet;

public class BitSetDemo {
    public static void main(String[] args) {
        //总长度
        int count = 10;
        //随机取四个
        int i = 4;
        BitSet bit = new BitSet(count);

        while (i > 0) {
            //mei有判重
            bit.set((int) (Math.random() * count));
            i--;
        }

        for (int index = 0; index < count; index++) {
            if (bit.get(index)) {
                System.out.print(index + ",");
            }
        }


    }
}
